﻿package lu.kyle {
	public final class IntBlock {
		public var data:int;
		public var next:IntBlock;
		public var down:IntBlock;
		public function IntBlock(dt:int, nx:IntBlock, dn:IntBlock) {
			data = dt;
			next = nx;
			down = dn;
		}
		public static function create8_8(src:Array):IntBlock {
			if(src.length != 64) return null;

			var item:IntBlock = null;
			var c7:IntBlock = null;
			var c6:IntBlock = null;
			var c5:IntBlock = null;
			var c4:IntBlock = null;
			var c3:IntBlock = null;
			var c2:IntBlock = null;
			var c1:IntBlock = null;
			var c0:IntBlock = null;

			var i:int = src.length;
			while(i > 0) {
				c7 = item = new IntBlock(src[--i], item, c7);
				c6 = item = new IntBlock(src[--i], item, c6);
				c5 = item = new IntBlock(src[--i], item, c5);
				c4 = item = new IntBlock(src[--i], item, c4);
				c3 = item = new IntBlock(src[--i], item, c3);
				c2 = item = new IntBlock(src[--i], item, c2);
				c1 = item = new IntBlock(src[--i], item, c1);
				c0 = item = new IntBlock(src[--i], item, c0);
			}
			return item;
		}
	}
}
